<template>
  <div class="clearfix header">
    <el-dropdown class="user fr">
      <span class="el-dropdown-link">
        欢迎您，{{nickname}}<i class="el-icon-arrow-down el-icon--right"></i>
      </span>
      <el-dropdown-menu slot="dropdown">
        <el-dropdown-item>个然中心</el-dropdown-item>
        <el-dropdown-item>修改密码</el-dropdown-item>
        <el-dropdown-item>退出登录</el-dropdown-item>
      </el-dropdown-menu>
    </el-dropdown>
    <div class="date fr">这是在你在阿里的<span class="showtime">{{showTime}}</span>天</div>
  </div>
</template>

<script>
import {get} from "../utils/http.js"
export default {
    data(){
        return {
            date:''
        }
    },
    computed:{
        nickname(){
            return sessionStorage.getItem("nickname")
        },
        showTime(){
            let time = new Date(this.date)
            let now = new Date();
            return Math.floor((now-time)/1000/60/60/24)
        }
    },
    methods:{
        
    },
    mounted(){
            get('/in').then((res)=>{
                this.date = res.time
            })
    }
};
</script>

<style lang="less" scoped>
.header {
  line-height: 60px;
  color: #606266;
}
.user{
    margin-left: 30px;
} 
.showtime{
    color: #40a9ff;
    font-size: 20px;
    padding: 0 5px;
}
</style>
